package com.hsu.yupao.service;

import com.hsu.yupao.model.domain.Friend;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hsu.yupao.model.domain.User;
import com.hsu.yupao.model.request.FriendAddRequest;
import com.hsu.yupao.model.vo.FriendRecordsVO;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
* @author 幽琴健
* @description 针对表【friend(好友申请表)】的数据库操作Service
* @createDate 2024-06-02 15:42:03
*/
public interface FriendService extends IService<Friend> {

    /**
     * 好友申请
     * @param friendAddRequest
     * @param loginUser
     * @return
     */
    boolean addFriend(FriendAddRequest friendAddRequest, User loginUser);

    /**
     * 获取我收到的所有申请记录
     * @param loginUser
     * @return
     */
    List<FriendRecordsVO> getFriendRecords(User loginUser);

    /**
     * 获取我发出的所有申请记录
     * @param loginUser
     * @return
     */
    List<FriendRecordsVO> getMyRecords(User loginUser);

    /**
     * 获取未读记录条数
     * @param loginUser
     * @return
     */
    long getUnreadRecordCount(User loginUser);

    /**
     * 标记指定的好友申请为已读
     * @param loginUser
     * @param ids
     * @return
     */
    boolean markAsRead(User loginUser, Set<Long> ids);

    /**
     * 同意好友申请
     * @param loginUser
     * @param fromUserid
     * @return
     */
    boolean agreeToApply(User loginUser, Long fromUserid);

    /**
     * 撤销好友申请
     * @param id
     * @param loginUser
     * @return boolean
     */
    boolean cancelApply(Long id, User loginUser);

}
